import express from 'express';
import Config from '../../../config/config.config';
import httpsApi from '../../lib/httpsapi'; // 微信接口API
const router = express.Router();

router.get('/', async function (Request, Response, next) {
  let query = Request.query
  
  let urlList = Config.urlList
  
  let html = ''
  
  urlList.forEach((item, index) => {
    httpsApi.test(item).then(res => {
      html += `<h2 style="color: green">${urlList[index]}  √</h2>`
    }).catch(err => {
      html += `<h2 style="color: red">${urlList[index]}  ×</h2>`
    })
  })
  
  setTimeout(() => {
    Response.setHeader('Content-Type', 'text/html');
    Response.send( // dev测试环境，release正式环境
      html
    )
  }, 5000)
  
});



module.exports = router;